package com.sccba.emtbusiness.enums;

import com.sccba.common.utils.StringUtils;

public enum DutyType {
    XC_DUTY(0, "现场值班"),
    PHONE_DUTY(1, "电话值班");

    private final Integer code;
    private final String info;

    DutyType(Integer code, String info)
    {
        this.code = code;
        this.info = info;
    }

    public static String getInfoByCode (Integer code) {
        if (null == code) {
            return "";
        }
        String name = "";
        for (DutyType dutyType : DutyType.values()) {
            if (dutyType.getCode() == code) {
                name = dutyType.getInfo();
                break;
            }
        }
        if (StringUtils.isEmpty(name) || "现场值班".equals(name)) {
            return "";
        }
        return "-" + name;
    }

    public Integer getCode()
    {
        return code;
    }

    public String getInfo()
    {
        return info;
    }
}
